yjx.directive('updateSupport',['$rootScope','$compile','$timeout',function($rootScope,$compile,$timeout) {
    return{
        restrict: 'EAC',
        scope: false,
        link: function ($scope, $element, attr) {
            $scope._updated = false;
            //console.log($scope._updated)
            $scope.$watch(attr.updateSupport, function (newVal) {
                $timeout(function () {
                    $scope.addhtml(newVal);
                })
                var html = ''
                $scope.addhtml = function (updated) {
                    //console.log(updated)
                    //console.log($scope.resourceList);
                    //for(var i in $scope.resourceList) {
                    //    console.log("resourceList=================="+ $scope.resourceList[i].id);
                    //}
                    /*html拼接前面一定不能留空格*/
                    //html += '<li class="sptItem dfr borderT10 " ng-repeat="item in resourceList track by $index"> <div class="sptLeft dfc jsc aic"> <div class="sptImg"><img class="wh100" ng-src="{{item.avatar}}"></div></div><div class="sptRight dfc jssa "><div class="sptTitle f14 dfr asc over-hide"> {{item.title}}</div> <div class="sptTags dfr aic fww "> <span class="f12 cmain">内容标签:</span> <a class="tag1 sptTag" ng-repeat="tag in item.tags">{{tag.name}}</a> </div> <div class="dfr asfe"><span class="btn_m sptGo" ui-sref="surDetail({id:item.id})">查看详情</span></div></div></li>';

                    html+='<li class="sptItem dfr borderT10 " ng-repeat="item in resourceList"  ng-click="onClick(item.id)" ui-sref="surDetail({id:item.id})"> <div class="sptLeft dfc jsc aic"> <div class="sptImg"><img class="wh100" ng-src="{{item.avatar}}"></div></div> <div class="sptRight dfc jssb "><div class="sptTitle f14 dfr asc "> {{item.title}}</div> <div class="dfr aic jssb"> <div class="spTags dfr aic "> <a class="sptf9 sptTag" ng-repeat="tag in item.tags">{{tag.name}}</a> </div> <div class="sptf9">{{item.clickTimes?item.clickTimes:0}}阅读</div> </div> </div> </li>'
                    var $html = $compile(html)($scope);
                    $element.html($html);
                }
            },true)
        }
    }
}])